package cn.edu.gues.infosystam.mapper;

import cn.edu.gues.infosystam.entity.Cclass;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 苏小小
 * @since 2020-06-11
 */
public interface CclassMapper extends BaseMapper<Cclass> {

    /**
     * 获取所有学院
     * @return
     */
    @Select("SELECT DISTINCT cclass.college FROM cclass WHERE cclass.deleted = 0")
    List<Cclass> getAllCollege();

    /**
     * 获取指定学院的班级信息
     * @param college
     * @return
     */
    @Select("SELECT DISTINCT cclass.cid, cclass.cname, cclass.college FROM cclass WHERE cclass.deleted = 0 and cclass.college = #{college} ORDER BY cname")
    List<Cclass> getClassByCollege(String college);

}
